onload = () => {
    loadCSS("../css/fontello.css", "bootstrap5-icon");
    loadCSS("../css/bootstrap5.min.css", "bootstrap5");
    loadCSS("../css/common.css", "common");
    loadScript("../js/bootstrap5.bundle.min.js").then(() => loadScript("../js/crud.js")).then(() => {
        let taskOperator = new Crud({
            module: "task",
            hasCheckbox: true,
            iterators: [{
                name: "task.status",
                iterator: [{"value": 0, "caption": "normal"}, {"value": 1, "caption": "Processing"}, {
                    "value": 2,
                    "caption": "Success"
                }, {"value": 4, "caption": "Fail"}, {"value": 8, "caption": "Audited"}]
            },
                {name: "task.type", iterator: [{"value": 1, "caption": "AR Import"}, {"value": 2, "caption": "AP Import"},, {"value": 3, "caption": "Export"}]}],
            opsButton: ["export"],
            search: [{"caption": "Type", "type": "combo", "name": "type",iterator: "blank_ALL_task.type", class: "col-3"},
                {"caption": "Status", "type": "combo", "name": "status",iterator: "blank_ALL_task.status", class: "col-3"},
                {"caption": "Date From", "type": "date", "name": "dateFrom", class: "col-3"},
                {"caption": " To", "type": "date", "name": "dateTo", class: "col-3"}
            ],
            rowBtn:[],
            listField: [{"caption": "ID", "field": "taskId"},
                {"caption": "Occur Time", "field": "updateTime"}
                ,{"caption": "Task Name", "field": "taskName"}, {"caption": "Message", "field": "message"},{"caption": "Type", "field": "type",iterator:"task.type"},{"caption": "Status", "field": "status",iterator:"task.status"}]
        });
        taskOperator.init()
    }).catch((err) => console.error(err));
}
